package ui20131001.service
{
	import mx.controls.Alert;
	
	import ui20131001.helper.IndividualUsersService;

	/**
	 * @author : LIMIN
	 * @time : 2013-10-21 上午11:02:35
	 * 
	 * @remarks :取得设备定位记录
	 */
	
	public class IndiGetPositionDataCmd extends InterfaceBaseCommand
	{
		public function IndiGetPositionDataCmd(callback:Function, params:Object=null)
		{
			super(callback, params);
		}
		
		override public function execute():void
		{
			IndividualUsersService.getPositionData(onResponse, _params.device_id,
				_params.bDate, _params.bHour, _params.bMin, 
				_params.eDate, _params.eHour, _params.eMin);
		}
		
		override protected function onResponse(data:Object):void
		{
			super.onResponse(data);
			if(data.status==1)
			{
				onSuccess(data);
			}else
			{
				var errorStr:String = "";
				switch(data.status)
				{
					case -1000:
						errorStr = "尚未登录用户，请登录";
						break;
					case -1:
						errorStr = "设备id未知";
						break;
					case -2:
						errorStr = "禁止或无权限查看数据";
						break;
					case -3:
						errorStr = "数据表不存在";
						break;
					case -4:
						errorStr = "时间不合法";
						break;
					case -5:
						errorStr = "起始时间超过结束时间";
						break;
					case 0:
						errorStr = "没有定位信息";
						break;
					default:
						errorStr = "error: "+data.status;
				}
				Alert.show(errorStr,"数据获取失败");
			}
		}
		
	}
}